import React, { Component, useState } from 'react';

export function DragMove(Comp) {
  return class _ extends Component {
    constructor() {
      super();
      this.state = { classDrag: 'dragBox', top: 0, left: 0 };
    }
    scrollLocation = () => {
      //   console.log('1', document.documentElement.scrollTop);
      // todo 相对于文档
      //   console.log(window.event.pageX, window.event.pageY);
      // todo 相对于屏幕
      //   console.log(window.event.screenX, window.event.screenY);
      // todo 相对于浏览器

      console.log(window.event.clientX, window.event.clientY);
    };
    
    render() {
      return (
        <Comp
          classDrag={this.state.classDrag}
          scrollLocation={this.scrollLocation}
        //   scrollMove={this.scrollMove}
          textContent={this.props.children}
          top={this.props.top}
        />
      );
    }
  };
}
